package com.zbs.framework.common.handler;


import com.zbs.framework.common.utils.IError;

public class FrameworkBusinessRuntimeException extends RuntimeException  {

	private Throwable rootCause;

	public FrameworkBusinessRuntimeException(IError error){
		super(error.getErrMsg());
		this.errCode = error.getErrCode();
		this.errorKey = error.getErrMsg();
	}

	public FrameworkBusinessRuntimeException(String arg0) {
		super(arg0);
		this.errorKey = arg0;
		rootCause = this;
	}
	
	public FrameworkBusinessRuntimeException(Integer errCode, String arg0) {
		super(arg0);
		this.errCode = errCode;
		this.errorKey = arg0;
		rootCause = this;
	}

	public FrameworkBusinessRuntimeException() {
		super();
	}

	public FrameworkBusinessRuntimeException(String s, Throwable e) {
		this(s);
		if (e instanceof FrameworkBusinessRuntimeException) {
			rootCause = ((FrameworkBusinessRuntimeException) e).rootCause;
		} else {
			rootCause = e;
		}
	}

	public FrameworkBusinessRuntimeException(Throwable e) {
		this("", e);
	}

	public Throwable getRootCause() {
		return rootCause;
	}

	private String errorKey;
	private Integer errCode;

	public String getErrorKey() {
		return errorKey;
	}

	public Integer getErrCode() {
		return errCode;
	}
}